package com.skt.domain.DTO.request;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * 商家更新服装请求对象
 *
 * 说明：
 * - 用于 PUT /merchant/costumes/{id} 接口
 * - 表示对服装可编辑字段的完整更新（非 PATCH 部分更新）
 * - merchantId 由后端自动注入，前端禁止传入
 * - 核心业务字段（名称、类别、尺码、日租金）必须提供，确保数据完整性
 */
@Data
@Accessors(chain = true)
@Schema(description = "商家更新服装请求（完整更新）")
public class MerchantCostumeUpdateRequest {

    @NotBlank(message = "服装名称不能为空")
    @Length(min = 1, max = 100, message = "服装名称长度必须在1-100之间")
    @Schema(description = "服装名称", requiredMode = Schema.RequiredMode.REQUIRED)
    private String name;

    @NotBlank(message = "类别不能为空")
    @Length(max = 50, message = "类别长度不能超过50")
    @Schema(description = "类别：古装/现代/民族/舞台特效等", requiredMode = Schema.RequiredMode.REQUIRED)
    private String category;

    @NotBlank(message = "尺码不能为空")
    @Length(max = 20, message = "尺码长度不能超过20")
    @Schema(description = "尺码：S/M/L/XL/定制等", requiredMode = Schema.RequiredMode.REQUIRED)
    private String size;

    @Length(max = 30, message = "颜色长度不能超过30")
    @Schema(description = "颜色")
    private String color;

    @Length(max = 50, message = "品牌长度不能超过50")
    @Schema(description = "品牌/来源")
    private String brand;

    @Schema(description = "购入日期")
    private LocalDate purchaseDate;

    @DecimalMin(value = "0.00", inclusive = true, message = "购入价格不能为负数")
    @Digits(integer = 10, fraction = 2, message = "购入价格格式不正确（最多10位整数，2位小数）")
    @Schema(description = "购入价格（元）")
    private BigDecimal price;

    @NotNull(message = "日租金不能为空")
    @DecimalMin(value = "0.01", message = "日租金必须大于0")
    @Digits(integer = 10, fraction = 2, message = "日租金格式不正确（最多10位整数，2位小数）")
    @Schema(description = "日租金（元）", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal rentalPrice;

    @Length(max = 500, message = "描述长度不能超过500")
    @Schema(description = "描述（材质、特点、适用场景等）")
    private String description;

    @Length(max = 255, message = "图片URL长度不能超过255")
    @Pattern(regexp = "^https?://.*$", message = "图片URL必须是有效的HTTP/HTTPS链接")
    @Schema(description = "图片URL（必须为有效网络地址）")
    private String imageUrl;
}